﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using PatientInformationExtract.MainInterface.Models.XMLCS;
using PanGu;
using PatientInformationExtract.MainInterface.Views;
using PatientInformationExtract.MainInterface.Models;

namespace PatientInformationExtract.MainInterface.Views
{
    /// <summary>
    /// Interaction logic for ProcessNoteWindow.xaml
    /// </summary>
    public partial class ProcessNoteWindow : Window
    {
        private ProcessNoteUnit _unit;
        public ProcessNoteUnit ProcessNoteUnit { get { return this._unit; } }
        private PatientInformationExtractWindow _parent;

        public ProcessNoteWindow(ProcessNoteUnit unit, PatientInformationExtractWindow parent)
        {
            InitializeComponent();
            _unit = unit;
            _parent = parent;
            parent.ProcessNoteWindowCloseEvent += new PatientInformationExtractWindow.ProcessNoteWindowCloseHandler(ProcessNoteWindowClose);
        }

        private void ProcessNoteWindowClose()
        {
            _parent.ProcessNoteWindowCloseEvent -= ProcessNoteWindowClose;
            this.Close();
        }

        private void rtbContent_IsCheckedChange(object sender, RoutedEventArgs e)
        {
            StaticMethod.DisplayOnRichTextBox(_unit.Words, ref rtbContent);
        }

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            txtTime.Text = _unit.Time;
            txtType.Text = _unit.Type;
            txtDoctor.Text = _unit.Doctor;
            StaticMethod.DisplayOnRichTextBox(_unit.Words, ref rtbContent);
        }
    }
}
